﻿#include "scorepanel.h"
#include "ui_scorepanel.h"
#include <QFont>
const QString MYCOLOR[]={"black","white","red","blue","green"};
ScorePanel::ScorePanel(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::ScorePanel)
{
    ui->setupUi(this);
    m_list<<ui->user<<ui->leftRobot<<ui->rightRobot
         <<ui->userscore<<ui->leftscore<<ui->rightscore
        <<ui->score1<<ui->score2<<ui->score3;
}

ScorePanel::~ScorePanel()
{
    delete ui;
}

void ScorePanel::setScores(int left, int right, int user)
{
    ui->leftscore->setText(QString::number(left));
    ui->rightscore->setText(QString::number(right));
    ui->userscore->setText(QString::number(user));
}

void ScorePanel::setMyFontSize(int point)
{
    QFont font("微软雅黑",point,QFont::Bold);
    for(int i=0;i<m_list.size();++i)
    {
        m_list[i]->setFont(font);
    }
}

void ScorePanel::setMyFontColor(ScorePanel::FontColor color)
{
    for(int i=0;i<m_list.size();++i)
    {
        QString style=QString("QLabel{color:%1}").arg(MYCOLOR[color]);
        m_list[i]->setStyleSheet(style);
    }
}
